<?php

namespace App\Http\Controllers\admin\validate;

use Illuminate\Support\Facades\Validator;

class Equipment
{




    public static function bySn($param){
        $rules = [
            'sn'=>'required',
        ];
        $msg = [
            'sn.required'=>'sn不能为空',
        ];
        return Validator::make($param,$rules,$msg)->errors()->all();
    }

    public static function byUid($param){
        $rules = [
            'userId'=>'required',
        ];
        $msg = [
            'userId.required'=>'用户编号不能为空',
        ];
        return Validator::make($param,$rules,$msg)->errors()->all();
    }


    public static function updateSnType($param){
        $rules = [
            'userId'=>'required|numeric',
            'type'=>'required|numeric',
            'type_id'=>'required|numeric',
            'sn_id'=>'required',
        ];
        $msg = [
            'userId.required'=>'用户编号为空',
            'userId.numeric'=>'用户编号格式不对',
            'type.required'=>'类型为空',
            'type.numeric'=>'类型格式不对',
            'type_id.required'=>'类型编号为空',
            'type_id.numeric'=>'类型编号格式不对',
            'sn_id.required'=>'sn编号为空',
        ];
        return Validator::make($param,$rules,$msg)->errors()->all();
    }

    public static function multipleUpdateSnType($param){
        $rules = [
            'userId'=>'required|numeric',
            'type'=>'required|numeric',
            'type_id'=>'required|numeric',
            'file'=>'required',
        ];
        $msg = [
            'userId.required'=>'用户编号为空',
            'userId.numeric'=>'用户编号格式不对',
            'type.required'=>'类型为空',
            'type.numeric'=>'类型格式不对',
            'type_id.required'=>'类型编号为空',
            'type_id.numeric'=>'类型编号格式不对',
            'file.required'=>'文件为空',
        ];
        return Validator::make($param,$rules,$msg)->errors()->all();
    }


}
